// 转换数值
const toNewNumber = (num, unit) => {
	const arr = (num / unit + "").split(".");
	return `${arr[0]}${arr[1][0] != 0 ? "." + arr[1][0] : ""}`;
};

// 超过千、万数值转换成千、万为单位并取整，其他情况不变
// let afternum = parseInt(Math.round((num / 1000) * 100) / 100);
export const numberConvert = num => {
	if (num >= 1000 && num < 10000) {
		let numstr = toNewNumber(num, 1000) + "K";
		return numstr;
	} else if (num >= 10000) {
		let numstrs = toNewNumber(num, 10000) + "K";
		return numstrs;
	} else {
		return num;
	}
};
